# -*- coding: utf-8 -*-
"""
# @created on : 9月 2021/9/27 09:25
# @author     : kevin
# @file       : valid.py
# @software   : PyCharm
# @project    : auto_keyword_data


@license: (C) Copyright 2019-2025, Corporation Limited.
@desc:
"""
import ddddocr


class Valid:
    def __init__(self):
        self.ocr = ddddocr.DdddOcr()

    def img_valid(self, img):
        with open(img, 'rb') as f:
            img_bytes = f.read()
        return self.ocr.classification(img_bytes)

    def bytes_valid(self, bytes):
        return self.ocr.classification(bytes)
